package com.qqtech.qquan.mall.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qqtech.core.frame.model.Result;
import com.qqtech.core.frame.service.BaseService;
import com.qqtech.qquan.mall.model.MallSupplierUser;
import com.qqtech.qquan.mall.model.MallSupplierUserQuery;
import com.qqtech.qquan.mall.model.MallSupplierUserVo;
import com.qqtech.qquan.mall.service.MallSupplierUserService;
import com.qqtech.web.context.BaseWebController;

@Controller
@RequestMapping(value = "/mall/supplier/user")
public class MallSupplierUserController extends BaseWebController<MallSupplierUser, MallSupplierUserQuery> {
	@Resource
	private MallSupplierUserService mallSupplierUserService;
    
	@Override
	protected BaseService<MallSupplierUser> getBaseService() {
		return mallSupplierUserService;
	}
	
	/**
	 * 详情
	 * 
	 * @param mallSupplierQuery
	 * @return
	 */
	@RequestMapping(value = "/getSupplierByUser")
	@ResponseBody
	public Result getSupplierByUser(@RequestBody MallSupplierUserQuery mallSupplierUserQuery) {
		Result result = new Result();
		MallSupplierUserQuery query = new MallSupplierUserQuery();
		query.setUserId(super.getUserId());
		List<MallSupplierUserVo> mallSupplierUserList = mallSupplierUserService.queryList(query);
		if(mallSupplierUserList != null && mallSupplierUserList.size() > 0){
			MallSupplierUser msu = new MallSupplierUser();
			msu = mallSupplierUserList.get(0);
			result.put("supplierUser", msu);
		}
		return result;
	}
}
